<?php
/**
 * Defines an abstract controller. Its main purpose is to query data from models and pass it to Servlets::$models attribute factory.
 */
abstract class Controller {
	/**
	 * Implements the three stages of a controller job
	 */
	public function __construct() {
		$this->init();
		$this->service();
		$this->destroy();
	}
	
	/**
	 * Performs starting application-specific controller operations. Must be implemented by a base controller, extended by page controllers.
	 */
	abstract protected function init();
	
	/**
	 * Performs page-specific controller operations. Must be implemented by a class for each page.
	 */
	abstract protected function service();
	
	/**
	 * Performs ending application-specific controller operations. Must be implemented by a base controller, extended by page controllers.
	 */
	abstract protected function destroy();
}